﻿<Application x:Class="Application"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:my="clr-namespace:Caps.Console"
    xmlns:MyMy="clr-namespace:Caps.Console.My"
    StartupUri="../winMain.xaml"
    xmlns:sys="clr-namespace:System;assembly=mscorlib"
    xmlns:conv="clr-namespace:Tools.WindowsT.WPF.ConvertersT;assembly=Tools.Windows"
    xmlns:controlsT="clr-namespace:Tools.WindowsT.WPF.ControlsT;assembly=Tools.Windows"
    xmlns:res="clr-namespace:Caps.Console.My.Resources"
    xmlns:convertersT="clr-namespace:Tools.WindowsT.WPF.ConvertersT;assembly=Tools.Windows"
>
    
    <Application.Resources>
       
        <Style TargetType="ComboBox" x:Key="GenericComboBoxTemplate">
            <Setter Property="ItemContainerStyle">
                <Setter.Value>
                    <Style TargetType="{x:Type ComboBoxItem}">
                        <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
                    </Style>
                </Setter.Value>
            </Setter>
            <Setter Property="HorizontalContentAlignment" Value="Stretch"/>
        </Style>

        
        <ControlTemplate TargetType="{x:Type ItemsControl}" x:Key="ScrollableItemsControl">
            <ScrollViewer CanContentScroll="True" VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}" HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}" IsTabStop="False" >
                <ItemsPresenter/>
            </ScrollViewer>
        </ControlTemplate>


        <conv:NotBooleanValueConverter x:Key="NotBooleanValueConverter"/>
        <convertersT:HalfConverter x:Key="HalfConverter"/>

        <ControlTemplate TargetType="{x:Type controlsT:NumericUpDown}" x:Key="NumericUpDownDefaultTemplate">
            <Grid Margin="0" Focusable="False" >
                <Grid.RowDefinitions>
                    <RowDefinition/>
                    <RowDefinition/>
                </Grid.RowDefinitions>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="*"/>
                    <ColumnDefinition Width="Auto"/>
                </Grid.ColumnDefinitions>
                <TextBox Name="PART_EditableTextBox" IsReadOnly="{TemplateBinding IsEditable, Converter={StaticResource NotBooleanValueConverter}}" Text="{Binding RelativeSource={RelativeSource TemplatedParent}, Path=ValueString}"  TextAlignment="Right" Padding="5" HorizontalAlignment="Stretch" VerticalAlignment="Center" Grid.Row="0" Grid.Column="0" Grid.RowSpan="2" my:AttachedProperties.SelectAllOnFocus="true" IsTabStop="True" Focusable="True">
                    <TextBox.InputBindings>
                        <KeyBinding Key="Up" Command="{x:Static controlsT:NumericUpDown.IncreaseCommand}"/>
                        <KeyBinding Key="Down" Command="{x:Static controlsT:NumericUpDown.DecreaseCommand}"/>
                    </TextBox.InputBindings>
                </TextBox>
                <RepeatButton Command="{x:Static controlsT:NumericUpDown.IncreaseCommand}"  Grid.Column="1" Grid.Row="0" Width="Auto" Height="Auto" FontSize="{TemplateBinding FontSize, Converter={StaticResource HalfConverter}}" Padding="0" Focusable="True" IsTabStop="False">▲</RepeatButton>
                <RepeatButton Command="{x:Static controlsT:NumericUpDown.DecreaseCommand}"  Grid.Column="1" Grid.Row="1" Width="Auto" Height="Auto" FontSize="{TemplateBinding FontSize, Converter={StaticResource HalfConverter}}" Padding="0" Focusable="True" IsTabStop="False">▼</RepeatButton>
            </Grid>
        </ControlTemplate>

        <Style TargetType="{x:Type controlsT:NumericUpDown}" x:Key="{x:Type controlsT:NumericUpDown}">
            <Setter Property="HorizontalAlignment" Value="Center"/>
            <Setter Property="VerticalAlignment" Value="Center"/>
            <Setter Property="Template" Value="{StaticResource NumericUpDownDefaultTemplate}"/>
            <Setter Property="FocusManager.FocusedElement" Value="{Binding ElementName=PART_EditableTextBox}"/> 
            <Setter Property="Focusable" Value="False"/> 
            <Setter Property="IsTabStop" Value="False"/>
        </Style>

        <sys:Int32 x:Key="i64">64</sys:Int32>
        <my:ObjectImageConverter x:Key="ObjectImageConverter"/>
        <Style TargetType="ItemsControl" x:Key="ToolTipImageList">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Stretch"
                                    IsItemsHost="True" Orientation="Horizontal" 
                                    ScrollViewer.CanContentScroll="False" Height="auto"
                                    Width="auto" MaxHeight="64"
                                    ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Image Source="{Binding Path=., Converter={StaticResource ObjectImageConverter}, Mode=OneWay, ConverterParameter={StaticResource i64}}"
                               MaxWidth="64" MaxHeight="64" HorizontalAlignment="Center" VerticalAlignment="Center"
                               ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>

        <convertersT:NullInvisibleConverter x:Key="NullInvisibleConverter"/>
        <Style TargetType="ItemsControl" x:Key="ToolTipImageListEx">
            <Setter Property="ItemsPanel">
                <Setter.Value>
                    <ItemsPanelTemplate>
                        <StackPanel HorizontalAlignment="Left" VerticalAlignment="Stretch"
                                    IsItemsHost="True" Orientation="Horizontal" 
                                    ScrollViewer.CanContentScroll="False" Height="auto"
                                    Width="auto"
                                    ScrollViewer.HorizontalScrollBarVisibility="Hidden" 
                                    ScrollViewer.VerticalScrollBarVisibility="Hidden"/>
                    </ItemsPanelTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="auto"/>
                                <ColumnDefinition Width="16"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition Height="auto" MaxHeight="64"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/>
                                <RowDefinition Height="auto"/><RowDefinition Height="auto"/><RowDefinition Height="auto"/><RowDefinition Height="auto"/><RowDefinition Height="auto"/><RowDefinition Height="auto"/>
                            </Grid.RowDefinitions>
                            <Image Source="{Binding Path=., Converter={StaticResource ObjectImageConverter}, Mode=OneWay, ConverterParameter={StaticResource i64}}"
                                   Width="64" MaxHeight="64" HorizontalAlignment="Center" VerticalAlignment="Center"
                                   ScrollViewer.CanContentScroll="False" ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden"
                                   Grid.ColumnSpan="3" Grid.Row="0" Grid.Column="0"/>
                            <Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="3" Content="{Binding CapName, Mode=OneWay}" TextBlock.TextAlignment="Center" HorizontalAlignment="Center"/>
                            <Label Grid.Row="2" Grid.Column="0" Content="{Binding Shape.Size1Name, Mode=OneWay}"/>
                            <Label Grid.Row="2" Grid.Column="1" Grid.ColumnSpan="2" Content="{Binding Size, Mode=OneWay}"/>
                            <Label Grid.Row="3" Grid.Column="0" Content="{Binding Shape.Size2Name, Mode=OneWay}" Visibility="{Binding Shape.Size2Name, Converter={StaticResource NullInvisibleConverter}}"/>
                            <Label Grid.Row="3" Grid.Column="1" Grid.ColumnSpan="2" Content="{Binding Size2, Mode=OneWay}" Visibility="{Binding Shape.Size2Name, Converter={StaticResource NullInvisibleConverter}}"/>
                            <Label Grid.Row="4" Grid.Column="0" Content="{x:Static res:Resources.lbl_Height_Simple}"/>
                            <Label Grid.Row="4" Grid.Column="1" Grid.ColumnSpan="2" Content="{Binding Height, Mode=OneWay}"/>
                            <Label Grid.Row="5" Grid.Column="0" Content="{x:Static res:Resources.lbl_Shape}"/>
                            <Image Grid.Row="5" Grid.Column="1" Source="{Binding Shape, Converter={StaticResource ObjectImageConverter}}"/>
                            <Label Grid.Row="5" Grid.Column="2" Content="{Binding Shape.Name, Mode=OneWay}"/>
                            <Label Grid.Row="6" Grid.Column="0" Content="{x:Static res:Resources.lbl_MainType}"/>
                            <Image Grid.Row="6" Grid.Column="1" Source="{Binding MainType, Converter={StaticResource ObjectImageConverter}}"/>
                            <Label Grid.Row="6" Grid.Column="2" Content="{Binding MainType.TypeName, Mode=OneWay}"/>
                            <Label Grid.Row="7" Grid.Column="0" Content="{x:Static res:Resources.lbl_Material}"/>
                            <Label Grid.Row="7" Grid.Column="1" Grid.ColumnSpan="2" Content="{Binding Material.Name, Mode=OneWay}"/>
                            <Label Grid.Row="8" Grid.Column="0" Content="{x:Static res:Resources.lbl_Target}"/>
                            <Label Grid.Row="8" Grid.Column="1" Grid.ColumnSpan="2" Content="{Binding Target.Name, Mode=OneWay}"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="HorizontalAlignment" Value="Left"/>
            <Setter Property="BorderThickness" Value="0"/>
        </Style>

        <my:GetCapsOfConverter x:Key="GetCapsOfConverter"/>
        <Style TargetType="ComboBox" x:Key="ShapeTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTipService.ShowDuration="{x:Static sys:Int32.MaxValue}">
                            <Grid.ToolTip>
                                <Grid ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding Description, Mode=OneWay}" HorizontalAlignment="Left" TextAlignment="Left" Grid.Column="0" Grid.Row="0" Height="auto"/>
                                    <ItemsControl  Style="{StaticResource ToolTipImageList}" Grid.Column="0" Grid.Row="1" ItemsSource="{Binding Converter={StaticResource GetCapsOfConverter}, ConverterParameter=6}"/>
                                </Grid>
                            </Grid.ToolTip>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="19" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Width="19" Height="16" VerticalAlignment="Center" Source="{Binding ., Converter={StaticResource ObjectImageConverter}, Mode=OneWay}" Margin="0,0,3,0" Grid.Column="0" />
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding Name, Mode=OneWay}" Grid.Column="1"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding ShapeID, Mode=OneWay}" Grid.Column="2"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="Name"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="CapTypeTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTipService.ShowDuration="{x:Static sys:Int32.MaxValue}">
                            <Grid.ToolTip>
                                <Grid ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding Description, Mode=OneWay}" HorizontalAlignment="Left" TextAlignment="Left" Grid.Column="0" Grid.Row="0" Height="auto"/>
                                    <ItemsControl Style="{StaticResource ToolTipImageList}" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" ItemsSource="{Binding Converter={StaticResource GetCapsOfConverter}, ConverterParameter=6}"/>
                                </Grid>
                            </Grid.ToolTip>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="19"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Width="19" Height="16" VerticalAlignment="Center" Source="{Binding ., Converter={StaticResource ObjectImageConverter}, Mode=OneWay}" Margin="0,0,3,0" Grid.Column="0" />
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding TypeName, Mode=OneWay}" Grid.Column="1"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding CapTypeID, Mode=OneWay}" Grid.Column="2"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="TypeName"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="MainTypeTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTipService.ShowDuration="{x:Static sys:Int32.MaxValue}">
                            <Grid.ToolTip>
                                <Grid ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding Description, Mode=OneWay}" HorizontalAlignment="Left" TextAlignment="Left" Grid.Column="0" Grid.Row="0" Height="auto"/>
                                    <ItemsControl Style="{StaticResource ToolTipImageList}" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" ItemsSource="{Binding Converter={StaticResource GetCapsOfConverter}, ConverterParameter=6}"/>
                                </Grid>
                            </Grid.ToolTip>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="19"/>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Width="19" Height="16" VerticalAlignment="Center" Source="{Binding ., Converter={StaticResource ObjectImageConverter}, Mode=OneWay}" Margin="0,0,3,0" Grid.Column="0" />
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding TypeName, Mode=OneWay}" Grid.Column="1"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding MainTypeID, Mode=OneWay}" Grid.Column="2"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="TypeName"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="MaterialTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch"  ToolTipService.ShowDuration="{x:Static sys:Int32.MaxValue}">
                            <Grid.ToolTip>
                                <Grid ScrollViewer.HorizontalScrollBarVisibility="Hidden" ScrollViewer.VerticalScrollBarVisibility="Hidden">
                                    <Grid.ColumnDefinitions>
                                        <ColumnDefinition Width="auto"/>
                                    </Grid.ColumnDefinitions>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="auto"/>
                                        <RowDefinition Height="auto"/>
                                    </Grid.RowDefinitions>
                                    <TextBlock Text="{Binding Description, Mode=OneWay}" HorizontalAlignment="Left" TextAlignment="Left" Grid.Column="0" Grid.Row="0" Height="auto"/>
                                    <ItemsControl Style="{StaticResource ToolTipImageList}" Grid.Column="0" Grid.Row="1" HorizontalAlignment="Left" ItemsSource="{Binding Converter={StaticResource GetCapsOfConverter}, ConverterParameter=6}"/>
                                </Grid>
                            </Grid.ToolTip>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding Name, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding MaterialID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="Name"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="StorageTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTip="{Binding Description}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding StorageNumber, Mode=OneWay}" Grid.Column="0"/>
                            <StackPanel Orientation="Horizontal" VerticalAlignment="Center" Height="auto" HorizontalAlignment="Right" Grid.Column="1">
                                <TextBlock>(</TextBlock>
                                <TextBlock Text="{Binding StorageID, Mode=OneWay}" />
                                <TextBlock>)</TextBlock>
                            </StackPanel>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="StorageNumber"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="ProductTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTip="{Binding Description}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding ProductName, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding ProductID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="ProductName"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="ProductTypeTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch"  ToolTip="{Binding Description}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding ProductTypeName, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding ProductTypeID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="ProductTypeName"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="CompanyTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch"  ToolTip="{Binding Description}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding CompanyName, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding CompanyID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="CompanyName"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="TargetTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch"  ToolTip="{Binding Description}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding Name, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding targetID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="Name"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="SignTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch" ToolTip="{Binding Description, Mode=OneWay}">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="35" />
                                <ColumnDefinition Width="*" />
                                <ColumnDefinition Width="auto" />
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <Image Width="35" Height="32" VerticalAlignment="Center" Source="{Binding ., Converter={StaticResource ObjectImageConverter}, Mode=OneWay}" Margin="0,0,3,0" Grid.Column="0" />
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding Name, Mode=OneWay}" Grid.Column="1"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding CapSignID, Mode=OneWay}" Grid.Column="2"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="Name"/>
            <Setter Property="ToolTip" Value="{x:Static res:Resources.tot_Sign}"/>
        </Style>
        <Style TargetType="ComboBox" x:Key="StorageTypeTemplate" BasedOn="{StaticResource GenericComboBoxTemplate}">
            <Setter Property="ItemTemplate">
                <Setter.Value>
                    <DataTemplate>
                        <Grid HorizontalAlignment="Stretch">
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="auto"/>
                            </Grid.ColumnDefinitions>
                            <Grid.RowDefinitions>
                                <RowDefinition/>
                            </Grid.RowDefinitions>
                            <TextBlock HorizontalAlignment="Stretch" VerticalAlignment="Center" Height="auto" Text="{Binding Name, Mode=OneWay}" Grid.Column="0"/>
                            <TextBlock HorizontalAlignment="Right" VerticalAlignment="Center" Height="auto" Text="{Binding StorageTypeID, Mode=OneWay}" Grid.Column="1"/>
                        </Grid>
                    </DataTemplate>
                </Setter.Value>
            </Setter>
            <Setter Property="TextSearch.TextPath" Value="Name"/>
            <Setter Property="ToolTip" Value="{Binding Description}"/>
        </Style>
    </Application.Resources>
</Application>
